﻿<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>门诊诊疗管理</title>
<style type="text/css">
.bg{background:#E5E5E5}
.hidden {
	display: none;
}
</style>
<link href="${ctx}/css/layout.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/jquery-ui.css" rel="stylesheet" type="text/css" /> 
<link href="${ctx}/css/treeStyle.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${ctx}/js/clinic/clinicrecord.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="${ctx}/js/timers/jquery.timers-1.2.js"></script>
<script type="text/javascript" src="${ctx}/js/dateFormat/jquery.dateFormat-1.0.js"></script>
<script type="text/javascript">
	function setTime() {     
	       var currentTime = $.format.date(new Date(),"yyyy年MM月dd日hh:mm:ss");
	       $("#htmer_time").text(currentTime);
	 }
	 $('body').everyTime('1s',setTime);
</script>
 <script type="text/javascript">
 $(document).ready(function() {
	$("#tabs").tabs();
});

var date = new Date();
var diaglosis =null;
var today = date.getYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
//待诊列表数据
$("#example").html("");
		$.getJSON("clinic-record!returnJsonData.action", function(json) {
			$.each(json, function(i) {
			  var obj = "\/Date("+json[i].registerTime+")\/";
              var time = eval(obj.replace(/\/Date\((\d+)\)\//gi, "new Date($1)"));
			  var registerTime = time.getYear()+"-"+(time.getMonth()+1)+"-"+time.getDate();
			if(today==registerTime){
				if (json[i].registerType == 0) {
					json[i].registerType = "门诊";
				} else if (json[i].registerType == 1) {
					json[i].registerType = "急诊";
				}
				$("#example").append(
						"<tr onclick='tdClick(" + json[i].id + ","+0+")'>"
								+ "<td>" + json[i].id + "</td>" + "<td width='90px'>" + json[i].patient.idNumber
								+ "</td>" + "<td width='70px'>" + json[i].patient.name + "</td>" + "<td>"
								+ json[i].registerType + "</td>" + "</tr>");
						
				}else if(today==registerTime && $("#example").find("tr").length==0){	
				   $("#message").html("");
                   $("#message").append("<span>" + "今天没有诊疗患者信息!" + "</span>");
                  setTimeout('$("#message").html("")',5000);//5秒后消失

				}
				}				
			);
		});
		
//已诊列表数据
$("#exampleClinic").html("");
		$.getJSON("clinic-record!jsonDataDitail.action", function(json) {
			$.each(json, function(i) {
			diaglosis = json[i].diagnosis;
			  var obj = "\/Date("+json[i].registerTime+")\/";
              var time = eval(obj.replace(/\/Date\((\d+)\)\//gi, "new Date($1)"));
			  var registerTime = time.getYear()+"-"+(time.getMonth()+1)+"-"+time.getDate();
			if(today==registerTime){
				if (json[i].registerType == 0) {
					json[i].registerType = "门诊";
				} else if (json[i].registerType == 1) {
					json[i].registerType = "急诊";
				}
				$("#exampleClinic").append(
						"<tr onclick='tdClick(" + json[i].id + ","+1+")'>"
								+ "<td>" + json[i].id + "</td>" + "<td width='90px'>" + json[i].patient.idNumber
								+ "</td>" + "<td width='70px'>" + json[i].patient.name + "</td>" + "<td>"
								+ json[i].registerType + "</td>" + "</tr>");
			    
                }else if(today==registerTime && $("#exampleClinic").find("tr").length==0){
                 $("#message").html("");
                 $("#message").append("<span>" + "今天没有诊疗结束的患者!" + "</span>");
                 setTimeout('$("#message").html("")',5000);//5秒后消失
                }
								
			});
		});	
</script> 
</head>

<body>
<div align="left" style="font-family:Arial;font-size:15px;font-weight:bold;font-style:normal">当前位置：校园诊所--门急诊诊疗管理</div>
<form action="clinic-record.action" id="mainForm" method="post">
<div id="message" style="color:red"></div>
<div id="container"  class="ui-widget">
<div id="sidebar">
&nbsp;&nbsp;&nbsp;&nbsp;当前时间: <span id="htmer_time"></span>
<br />

<fieldset title=""><legend title="" align="top">待诊列表
</legend>

<div align="center">
<label>职工号/学号:</label><input type="text" id="tags" name="idNumber" value="${idNumber}" size="20" />
</div>
<table border="1" class="t1" height="20px">

	<tr class="a1">
		<td>序号</td>
		<td width='90px'>职工/学号</td>
		<td width='70px'>姓名</td>
		<td>状态</td>
	</tr>
</table>
<div id="dataJson" style="OVERFLOW: auto; WIDTH: 100%; HEIGHT: 120px"> 
<table border="1" class="t1" id="example" width="100%" height="100%">
</table>
</div>
<s:hidden name="clinic" id="clinicId"></s:hidden>
</fieldset>
<br />
<br />
<fieldset title=""><legend title="" align="top">已接诊
</legend>
<div align="center">
<label>职工号/学号:</label><input type="text" name="idNumberOne"  id="idNumberOne" value="${idNumberOne}" size="20" />
</div>
<table border="1" class="t1">
      
	<tr class="a1">
		<td>序号</td>
		<td width='90px'>职工/学号</td>
		<td width='70px'>姓名</td>
		<td>状态</td>
	</tr>
</table>

<div id="dataJson" style= "overflow: auto; width: 100%; height: 100px;"> 
<table border="1" class="t1" id="exampleClinic" width="100%" height="100%">

</table>
</div>
</fieldset>
</div>

<div id="space">
<fieldset><legend>患者基本信息</legend>
<input type="hidden" id="bzLeader" name="bzName" value="${bzName}"/>
<table border="1" class="t1">
<tr>
		<td>姓名</td>
		<td><span id="name"></span></td>
		<td>出生年月</td>
		<td><span id="birthday"></span></td>
	</tr>
	<tr>
		<td>性别</td>
		<td><span id="sex"></span></td>
		<td>就读班级</td>
		<td><span id="clazz"></span></td>
	</tr>
	
		<tr>
		<td>班主任</td>
		<td><span id="bzName"></span></td>
		<td>指导老师</td>
		<td><span id="zdName"></span></td>
	</tr>
</table>

<s:textarea name="symptom" rows="6" cols="" id="text2" value="" label="症状描述"></s:textarea></fieldset>
<p></p>
<div style="height:230px;width:100%">
<div id="tabs" class="ui-widget">
<ul>
	<li><a href="${ctx}/clinic/physical.action">检查化验</a></li>
	<li><a href="#tab-1">诊断结论</a></li>
	<li><a href="${ctx}/clinic/medication.action">医嘱&处方</a></li>

</ul>

<div id="tab-1">
<div style="height: 190px"><s:textarea name="diagnosis" rows="10" cols="30"
	id="texte" value="" label="诊断结论"></s:textarea></div>

</div>
</div>
<!-- <iframe width="100%" height="100%" frameborder="0"  scrolling="yes" src="${ctx}/clinic/clinic-record-input.action"></iframe> -->
<br />
<table>
	<tr>
		<td colspan="0"><input type="button" id="bc"  value="保存"  onclick="saveClinicRecord()"/></td>
		<td><input type="button" id="bc" value="诊疗结束" onclick="updateClinicRecord()"/></td>
		<td><input type="button" id="bc"value="转院处理"  onclick="referral();"/></td>
		<td colspan="2"><input type="button" id="bc" value="病假处理" onclick="leave();"/></td>
	</tr>
</table>
</div>
</div>
</div>
</form>
</body>
</html>